package com.xxf.aynu.parking;

import android.app.Activity;
import android.app.AlertDialog;
import android.content.DialogInterface;
import android.content.Intent;
import android.os.Bundle;
import android.view.View;
import android.widget.Button;
import android.widget.ListView;
import android.widget.TextView;
import android.widget.Toast;

import java.text.SimpleDateFormat;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * Created by Rossoneri on 2017/5/11 0011.
 */
public class activity_pay extends Activity{
    Button btn_pay;
    @Override
    protected void onCreate(Bundle savedInstanceState) {
        super.onCreate(savedInstanceState);
        setContentView(R.layout.fragment_weizhifu);

        SimpleDateFormat formater=new SimpleDateFormat("yyyy年MM月dd日   HH:mm:ss");
        Date curDate=new Date(System.currentTimeMillis());
        String st=formater.format(curDate);

        String str="天骄华府-地下停车场\n订单号: 000020\n"+"下单时间:"+st+"\n金额: 5元 ";
        TextView textView2=(TextView) findViewById(R.id.txt1);
        textView2.setText(str.toString());
        btn_pay=(Button)findViewById(R.id.jiesuan);
        btn_pay.setOnClickListener(new View.OnClickListener() {
            @Override
            public void onClick(View v) {
                showNormalDialog();
            }
        });
    }
    public void showNormalDialog(){
        /* @setIcon 设置对话框图标
         * @setTitle 设置对话框标题
         * @setMessage 设置对话框消息提示
         * setXXX方法返回Dialog对象，因此可以链式设置属性
         */
        final AlertDialog.Builder normalDialog = new AlertDialog.Builder(activity_pay.this);
        normalDialog.setIcon(R.drawable.dia);
        normalDialog.setTitle("支付");
        normalDialog.setMessage("确定支付?");
        normalDialog.setPositiveButton("确定", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                Toast.makeText(getApplicationContext(),"支付成功", Toast.LENGTH_SHORT).show();
                Intent intent=new Intent();
                intent.setClass(getApplicationContext(), activity_mine_fukuan.class);
                startActivity(intent);
                finish();
            }
        });
        normalDialog.setNegativeButton("关闭", new DialogInterface.OnClickListener() {
            @Override
            public void onClick(DialogInterface dialog, int which) {
                dialog.dismiss();
                //...To-do
            }
        });
        // 显示
        normalDialog.show();
    }

}
